#!/bin/bash
url="http://localhost:8084/azsg"

# Clear old result
rm --verbose ../result/fuel/*
rm --verbose ../result/dispenser/*

# make Fuel test
curl $url/fuels             > ../result/fuel/fuels
curl $url/fuels.html        > ../result/fuel/fuels.html
curl $url/fuel?id=95        > ../result/fuel/fuel
curl $url/fuel.json?id=95   > ../result/fuel/fuel.json
curl $url/fuel.xml?id=95    > ../result/fuel/fuel.xml

# make Dispenser test
curl $url/dispenser/get?id=902395 > ../result/dispenser/get.json
curl $url/dispenser/get.xml?id=902395 > ../result/dispenser/get.xml
curl --get --data 'json={"id":902395,"price":3000,"modified":1387359637173,"fuel":{"id":95,"name":"АИ-95"}}' $url/dispenser/update > ../result/dispenser/update.json

# Check results
diff --recursive -s ../result/fuel      ../model/fuel
diff --recursive -s ../result/dispenser ../model/dispenser

